import Vue from 'vue'
import Vuex from 'vuex'
import products from './modules/products'
import cart from './modules/cart'
Vue.use(Vuex)

export default new Vuex.Store({
    state: {
      count: 0,
      msg:"hello Vuex A"
    },
    getters:{
        reverseMsg(state){
          return state.msg.split("").reverse().join("")
        }
    },
    mutations: {
      increment (state,p) {
        state.count+=p
      }
    },
    actions:{
      incrementSync(context,p){
        context.commit('increment',p)
      }
    },
    modules: {
      products,
      cart
    }
  })
